import 'dart:async';

import 'package:check_app/api/request.dart';
import 'package:check_app/model/subjectInfo.dart';
import 'package:check_app/model/subjectList.dart';
import 'package:check_app/model/responseResult.dart';

const SAVE_PATH = '/subject/edit';

class SubjectDao {
  //待检物列表
  static Future fetchSubjectList(path, params) async {
    final response = await Request().get(path, queryParameters: params);
    return SubjectListResult.fromJson(response);
  }

  //待检物列表
  static Future fetchSubjectInfo(path, params) async {
    final response = await Request().get(path, queryParameters: params);
    return SubjectInfoResult.fromJson(response);
  }
  // 待检物详情
  static Future fetchSubjectInfoById(path) async {
    final response = await Request().get(path, queryParameters: {});
    return SubjectInfoResult.fromJson(response);
  }

  static Future save(params) async {
    final response = await Request().post(SAVE_PATH, queryParameters: params);
    return ResponseResult.fromJson(response);
  }

}
